Socket
Socket
Sign inDemoInstall

merge-refs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-refs

A function that merges React refs into one.


Version published
Weekly downloads
1.1M
increased by6.22%
Maintainers
1
Weekly downloads
 
Created

What is merge-refs?

The merge-refs npm package is a utility for combining multiple React refs into a single ref. This is particularly useful when you need to pass multiple refs to a single component or element.

What are merge-refs's main functionalities?

Combining Multiple Refs

This feature allows you to combine multiple refs into a single ref. In this example, `ref1` and `ref2` are combined and passed to a `div` element.

import React, { useRef } from 'react';
import mergeRefs from 'merge-refs';

const MyComponent = () => {
  const ref1 = useRef();
  const ref2 = useRef();

  return <div ref={mergeRefs([ref1, ref2])}>Hello World</div>;
};

Other packages similar to merge-refs

Keywords

FAQs

Package last updated on 30 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc